package com.digitalchina.lxnsy.api;

import android.app.Activity;
import android.os.Handler;

import com.digitalchina.lxnsy.constant.MSG;
import com.digitalchina.lxnsy.constant.URL;
import com.digitalchina.lxnsy.toolkit.OkHttpUtil;
import com.lzy.okhttputils.model.HttpParams;

/**
 * ================================================
 * 项目名称：BigData
 * 类描述：
 * 包名：com.digitalchina.bigdata.api
 * 创建人：白彦东
 * 创建时间：2016/10/20 10:12
 * 修改备注：
 * ================================================
 */

public class BusinessPest {

    /**
     * 获取农作物分类
     *
     * @param activity
     * @param handler
     */
    public static void getCropTypeList(Activity activity, Handler handler) {

        HttpParams params = new HttpParams();

        OkHttpUtil.post(activity, URL.URL_GET_CROP_TYPE_LIST, "", params, handler, MSG.MSG_GET_CROP_TYPE_LIST_SUCCESS, MSG.MSG_GET_CROP_TYPE_LIST_FIELD);

    }

    /**
     * 获取农作物分类
     *
     * @param activity
     * @param handler
     */
    public static void getDiseaseTypeList(Activity activity, Handler handler) {

        HttpParams params = new HttpParams();

        OkHttpUtil.post(activity, URL.URL_GET_DISEASE_TYPE_LIST, "", params, handler, MSG.MSG_GET_DISEASE_TYPE_LIST_SUCCESS, MSG.MSG_GET_DISEASE_TYPE_LIST_FIELD);

    }


    /**
     * @param activity
     * @param typeCode 子类code
     * @param symptom  病虫害特征
     * @param handler
     */
    public static void getDiagnosisList(Activity activity, String typeCode, String symptom, Handler handler) {

        HttpParams params = new HttpParams();
        params.put("typeCode", typeCode);
        params.put("symptom", symptom);

        OkHttpUtil.post(activity, URL.URL_GET_DIAGNOSIS_LIST, "", params, handler, MSG.MSG_GET_DIAGNOSIS_SUCCESS, MSG.MSG_GET_DIAGNOSIS_FIELD);

    }


    /**
     * 病毒害结果详情，推荐专家列表expertList，推荐农药pesList
     *
     * @param activity
     * @param id       诊断id
     * @param handler
     */
    public static void getDiagnosisContext(Activity activity, String id, Handler handler) {

        HttpParams params = new HttpParams();
        params.put("id", id);

        OkHttpUtil.post(activity, URL.URL_GET_DIAGNOSIS_CONTEXT, "", params, handler, MSG.MSG_GET_DIAGNOSIS_CONTEXT_SUCCESS, MSG.MSG_GET_DIAGNOSIS_CONTEXT_FIELD);

    }


    /**
     * @param activity
     * @param id       农药id
     * @param handler
     */
    public static void getPesticideDetail(Activity activity, String id, Handler handler) {

        HttpParams params = new HttpParams();
        params.put("id", id);

        OkHttpUtil.post(activity, URL.URL_GET_PESTICIDE_DETAIL, "", params, handler, MSG.MSG_GET_PESTICIDE_DETAIL_SUCCESS, MSG.MSG_GET_PESTICIDE_DETAIL_FIELD);

    }


}
